import 'package:flutter/material.dart';

/// 实现一个圆角图片2种方式 ，网络获取
/// 第一种是李东decoration的圆角属性
/// 第二种是利用clipOver

void main() {
  runApp(ImageTest());
}

class ImageTest extends StatelessWidget {
  const ImageTest({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
          appBar: AppBar(
            title: Text('Image 测试训练'),
          ),
          body: Center(
              child: Column(
            children: [
              Container(
                // alignment: Alignment.center,
                width: 200,
                height: 200,
                margin: EdgeInsets.only(bottom: 20),
                decoration: BoxDecoration(
                    borderRadius: BorderRadius.circular(100),
                    image: DecorationImage(
                        image: NetworkImage(
                          'https://q8.itc.cn/q_70/images03/20240730/94b5b82dd0ea4b129f634bec4f53d2f0.jpeg',
                        ),
                        fit: BoxFit.cover)),
                // child: Image.network(
                //   'https://q8.itc.cn/q_70/images03/20240730/94b5b82dd0ea4b129f634bec4f53d2f0.jpeg',
                //   fit: BoxFit.cover,
                // )
                // Column(
                //   children: [
                //     Image.network(
                //       'https://q8.itc.cn/q_70/images03/20240730/94b5b82dd0ea4b129f634bec4f53d2f0.jpeg',
                //       fit: BoxFit.cover,
                //     )
                //   ],
                // ),
              ),
              ClipOval(
                child: Image.network(
                  'https://q8.itc.cn/q_70/images03/20240730/94b5b82dd0ea4b129f634bec4f53d2f0.jpeg',
                  width: 200,
                  height: 200,
                  fit: BoxFit.cover,
                ),
              ),
            ],
          ))),
    );
  }
}
